#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

string delk_max(string num, int k)
{
    if (k > num.length())
        return "";

    vector<int> slices; // 把每一位分离出来
    for (char ch : num)
        slices.push_back(ch - '0');

    for (auto it = slices.begin(); it != slices.end(); it--)
    {
        if (!k)
            break;

        while (it + 1 != slices.end() && *(it + 1) >= *(it))
            it++;
        slices.erase(it);
        k--;
    }

    string result;
    for (int n : slices)
        result.push_back(n + '0');
    return result;
}

int main()
{
    string num;
    int k;
    cout << "input num:";	// 178543
    cin >> num;
    cout << "input del num:";	// 4
    cin >> k;
    cout << delk_max(num, k) << endl;	// 13
    return 0;
}